package com.diaohw.module.metadata.obj.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.diaohw.module.metadata.enums.ItemTypeEnums;
import com.diaohw.platform.framework.db.obj.BaseModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serial;

/**
 * <p>
 * 元数据属性
 * </p>
 *
 * @author D-Hw
 * @since 2025-04-11
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("META_ITEM")
@Schema(name = "MetaItemDO", description = "元数据属性")
public class MetaItemDO extends BaseModel<MetaItemDO> {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 元数据ID
     */
    @Schema(description = "元数据ID")
    @TableField("META_ID")
    private String metaId;

    /**
     * 元数据CODE
     */
    @Schema(description = "元数据CODE")
    @TableField("META_CODE")
    private String metaCode;

    /**
     * 字段名称
     */
    @Schema(description = "字段名称")
    @TableField("ITEM_NAME")
    private String itemName;

    /**
     * 字段CODE
     */
    @Schema(description = "字段CODE")
    @TableField("ITEM_CODE")
    private String itemCode;

    /**
     * 字段类型
     */
    @Schema(description = "字段类型")
    @TableField("DATA_TYPE")
    private ItemTypeEnums dataType;

    /**
     * 是否为多条记录
     */
    @Schema(description = "是否为多条记录")
    @TableField("MULTIPLE_")
    private Boolean multiple;

    /**
     * 是否必填
     */
    @Schema(description = "是否必填")
    @TableField("REQUIRED")
    private String required;

    /**
     * 最小值
     */
    @Schema(description = "最小值")
    @TableField("MIN_VAL")
    private String minVal;

    /**
     * 最大值
     */
    @Schema(description = "最大值")
    @TableField("MAX_VAL")
    private String maxVal;

    /**
     * 默认值
     */
    @Schema(description = "默认值")
    @TableField("DEFAULT_VAL")
    private String defaultVal;

    /**
     * 单位
     */
    @Schema(description = "单位")
    @TableField("UNIT_")
    private String unit;

    /**
     * 备注
     */
    @Schema(description = "备注")
    @TableField("REMARK")
    private String remark;


    public boolean isMultiple() {
        return Boolean.TRUE.equals(multiple);
    }
}
